<?php echo $this->element('left_column')?>
<?php $this->Html->addCrumb('Trang chủ','/')?>
<?php $this->Html->addCrumb('Đơn hàng đã đặt')?>
<div class="mainColumn">
<form action="" method="post" id="frm_cardupdate" name="frm_cardupdate">
	<div class="accountPage">
		<h3>Đơn hàng đã đặt</h3>
	</div>
	<table summary="Employee Pay Sheet" id="tableOrder">
		<thead>
			<tr>
				<th width="57" style="text-align:center;" scope="col"><strong>#</strong></th>
				<th width="150" style="text-align:center;" scope="col"><strong>Ngày mua</strong></th>
				<th width="150" style="text-align:right;" scope="col"><strong>Giá trị hàng hóa</strong></th>
				<th width="150" style="text-align:center;" scope="col"><strong>Tình trạng</strong></th>				
				<th></th>
			</tr>
		</thead>		
		<tbody>
		<?php
		$total = 0;
		foreach($rs as $item):
			$total += $item['Order']['total'];
		?>
			<tr>
				<td style="text-align:center;"><?php echo $item['Order']['id']?></td>
				<td style="text-align:center;"><?php echo $item['Order']['created']?></td>
				<td style="text-align:right;"><?php echo number_format($item['Order']['total'])?> VND</td>
				<td style="text-align:center;"><?php echo $item['OrderStatus']['name']?></td>
				<td style="text-align:center;"><?php echo $this->Html->link('Chi tiết đơn hàng',array('controller'=>'orders','action'=>'detail',$item['Order']['id']))?></td>
			</tr>
		<?php endforeach;?>			
		</tbody>
		<thead>
			<tr>
				<th width="207" colspan='2' scope="col">&nbsp;<strong>Tổng giá trị các đơn hàng: </strong></th>
				<th width="150" style="text-align:right;" scope="col"><?php echo number_format($total)?> VND</th>
				<th width="150" style="text-align:center;" scope="col">&nbsp;</th>
				<th width="150" style="text-align:center;" scope="col">&nbsp;</th>				
			</tr>
		</thead>		
	</table>
</form>
</div>